<template>
	<view class='pages'>
		<scroll-view scroll-y="true" class='contentbox' @scrolltolower="scrolltolower">
			<view v-if="list.length == 0">
				<view style="height: 100rpx;"></view>
				<u-empty text=" - 暂无数据 - " mode="list"></u-empty>
			</view>
			<view class="uniFlex boxes" v-for="(item,index) in list" :key="index" @click="detail(item)">
				<!-- <img src="https://z1.ax1x.com/2023/11/15/piYcX5R.png" alt=""> -->
				<img v-if="item.images.length>0" :src="item.images[0]" alt="">
				<view class="newmsg">
					<view>{{item.content}}</view>
					<view>{{item.uname}}</view>
					<view class="uniBtn">
						<text>{{item.create_time}}</text>
						<text class="t1" v-if="item.status==0">待处理</text>
						<text class="t1" v-else-if="item.status==2">拒绝处理</text>
						<text class="t2"  v-else-if="item.status==1">已处理</text>
					</view>
				</view>
			</view>
		</scroll-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				page: 1,
				limit: 10,
				length: true,
				list: [
					// {id: 1,type:1},
					// {id: 1,type:2},
				],
			}
		},
		async onLoad() {
			await this.getList();
		},
		methods: {
			// 上拉
			scrolltolower() {
				console.log('触底')
				if (this.length) {
					this.page++
					this.getList();
				}
			},
			// 列表
			async getList() {
				let res = await this.$api.feedbacklist({
					page_no: this.page,
					page_size: this.limit,
				});
				if (res.code == 1) {
					this.length = res.data.length == this.limit;
					this.list.push(...res.data);
					// 关闭下拉
					uni.stopPullDownRefresh();
				}
			},
			detail(items){
				uni.navigateTo({
					url:'/pages/mains/feedback/detail?items='+JSON.stringify(items)
				})
			}
		}
	}
</script>

<style scoped lang="less">
	.pages {
		position: absolute;
		left: 0;
		top: 0;
		width: 100%;
		height: 100%;
		overflow: hidden;
		display: flex;
		flex-direction: column;
	}
	.contentbox {
		flex: 1;
		overflow: hidden;
		padding: 20rpx 15rpx;

		.boxes {
			padding: 30rpx 23rpx;
			background: #fff;
			margin-bottom: 20rpx;
			
			img{
				width: 160rpx;
				height: 160rpx;
				margin-right: 30rpx;
			}
			.newmsg{
				flex: 1;
				
				view:nth-child(1) {
					font-size: 30rpx;
					font-family: PingFang SC;
					font-weight: 800;
					color: #000000;
					line-height: 36rpx;
					overflow: hidden;
					text-overflow: ellipsis;
					// 只要超过宽度就换行，不论中文还是英文
					word-break: break-all;
					//最多展示两行
					display: -webkit-box;
					-webkit-box-orient: vertical;
					-webkit-line-clamp:2;
				}
				view:nth-child(2) {
					font-size: 28rpx;
					font-family: PingFang SC;
					font-weight: bold;
					color: #000000;
					white-space: nowrap;
					overflow: hidden;
					text-overflow: ellipsis;
					margin: 10rpx 0;
				}
				
				view:nth-child(3) {
					font-size: 28rpx;
					font-family: PingFang SC;
					font-weight: bold;
					color: #878787;
					
					.t1{
						color:#F03232;
					}
					.t2{
						color: #0980CC;
					}
				}
			}
		}
	}
</style>